﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MyMES.Domain.zyy;
using MyMES.Error;
using MyMES.Read.API.Application.Commends.Productionwork;
using MyMES.Read.API.Dtos;

namespace MyMES.Read.API.Controllers.ZMC.Productionwork
{
    [Route("api/[controller]/[Action]")]
    [ApiController]
    public class ProductionworkController : ControllerBase
    {
        private readonly IMediator mediator;

        public ProductionworkController(IMediator mediator)
        {
            this.mediator = mediator;
        }


        /// <summary>
        /// 获取生产工单
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
       
        [HttpGet]
        public async Task<APIPaging<List<WorkOrder>>> GetProductionwork([FromQuery]GetProductionworkCommends request, CancellationToken cancellationToken)
        {

            return await mediator.Send(request, cancellationToken);
        }


        /// <summary>
        /// 工单执行进度看板
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public async Task<APIResult<List<KanbanDtos>>> Kanban([FromQuery]KanbanCommends request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request, cancellationToken);
        }

        /// <summary>
        /// 获取生产订单--新
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public async Task<APIPaging<List<ProducStoresWorkOrdeDto>>> GetProductionorders([FromQuery]GetProductionordersCommends request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request, cancellationToken);
        }
    }
}
